package com.fr.base.core.antlr;

import java.io.PrintStream;

public class LLkParser extends Parser
{
  int k;

  public LLkParser(int paramInt)
  {
    this.k = paramInt;
  }

  public LLkParser(ParserSharedInputState paramParserSharedInputState, int paramInt)
  {
    super(paramParserSharedInputState);
    this.k = paramInt;
  }

  public LLkParser(TokenBuffer paramTokenBuffer, int paramInt)
  {
    this.k = paramInt;
    setTokenBuffer(paramTokenBuffer);
  }

  public LLkParser(TokenStream paramTokenStream, int paramInt)
  {
    this.k = paramInt;
    TokenBuffer localTokenBuffer = new TokenBuffer(paramTokenStream);
    setTokenBuffer(localTokenBuffer);
  }

  public void consume()
    throws TokenStreamException
  {
    this.inputState.input.consume();
  }

  public int LA(int paramInt)
    throws TokenStreamException
  {
    return this.inputState.input.LA(paramInt);
  }

  public Token LT(int paramInt)
    throws TokenStreamException
  {
    return this.inputState.input.LT(paramInt);
  }

  private void trace(String paramString1, String paramString2)
    throws TokenStreamException
  {
    traceIndent();
    System.out.print(paramString1 + paramString2 + ((this.inputState.guessing > 0) ? "; [guessing]" : "; "));
    for (int i = 1; i <= this.k; ++i)
    {
      if (i != 1)
        System.out.print(", ");
      if (LT(i) != null)
        System.out.print("LA(" + i + ")==" + LT(i).getText());
      else
        System.out.print("LA(" + i + ")==null");
    }
    System.out.println("");
  }

  public void traceIn(String paramString)
    throws TokenStreamException
  {
    this.traceDepth += 1;
    trace("> ", paramString);
  }

  public void traceOut(String paramString)
    throws TokenStreamException
  {
    trace("< ", paramString);
    this.traceDepth -= 1;
  }
}